﻿using System.Linq;
using RayDen.Library.Data.Imaging;
using RayDen.Library.Entity.Interface;

namespace RayDen.SmallPT
{
    public class ImagePlane : FilmFrame, IImagePlaneComponent
    {
        public ImagePlane(int w, int h) : base(w, h) { }

        #region IImagePlaneComponent Members

        public void UpdateScreenBuffer()
        {

        }

        public void Reset()
        {

        }

        public float[] GetScreenBuffer()
        {
            float[] r = new float[this.Data.Length*3];
            for (int i = 0; i < this.Data.Length; i++)
            {
                var px = Data[i];
                r[3*i] = px.c1;
                r[3*i+1] = px.c2;
                r[3*i+2] = px.c3;
            }
            return r;
        }

        #endregion
    }
}